package com.childmiles.gwt.client;

import com.childmiles.gwt.client.service.AwardWinnerService;
import com.childmiles.gwt.client.service.AwardWinnerServiceAsync;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class ApplicationEntryPoint implements EntryPoint {

    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {
        /**
         * If there were more services I'd pass in a ServiceRegistry 
         * holding all the serviceAsyncs. But for now just pass in our one service
         */
        final AwardWinnerServiceAsync awardWinnerService = GWT.create(AwardWinnerService.class);
        HandlerManager eventBus = new HandlerManager(null);
        ApplicationController applicationController = 
            new ApplicationController(awardWinnerService, eventBus);
        HasWidgets mainContent = new FlowPanel();
        RootPanel.get().add(new ApplicationPanel((Widget)mainContent));
        applicationController.go(mainContent);
    }

}
